package math;

import java.math.*;

public class BinaryOperatorNode implements MathNode
{
    String operator;
    MathNode leftOperand;
    MathNode rightOperand;

    public BinaryOperatorNode(MathNode left,String value,MathNode right)
    {
        this.operator = value;
        this.leftOperand = left;
        this.rightOperand = right;
    }

    @Override
    public String getExpressionString()
    {
        return "(" + leftOperand.getExpressionString() + " " + operator + " " + rightOperand.getExpressionString() + ")";
    }

    @Override
    public String getName()
    {
        return operator;
    }

    @Override
    public String toString()
    {
        return getClass().getName() + "<" + getExpressionString() + ">";
    }
}


